<?php
class Admin_AutocompleteController extends Zend_Controller_Action
{
    public function init ()
    {    
    	Zend_Loader::loadClass("AutocompleteModel");
    }
    
    public function indexAction ()
    {    
    	exit();
    }
    
    /**
     * @name itemType
     * Action for autocomplete with location data
     * @return json_encode
     */
    public function itemTypeAction ()
    {
        $request = $this->getRequest();
        $term = $request->getParam("term");

        $arr = AutocompleteModel::getItemType($term);
        echo json_encode($arr);
        
        exit();
    }
    
    /**
     * @name itemType
     * Action for autocomplete with location data
     * @return json_encode
     */
    public function itemServerAction ()
    {
        $request = $this->getRequest();
        $term = $request->getParam("term");

        $arr = AutocompleteModel::getServer($term);
        echo json_encode($arr);
        
        exit();
    }
    
    public function workAction(){
		$request = $this->getRequest();
        $term = $request->getParam("term");

        $arr = AutocompleteModel::getWork($term);
        echo json_encode($arr);
        
        exit();    	
    }
}
